<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>用户认证 | Laravel 5.1 中文文档
</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="author" content="Taylor Otwell">
	<meta name="description" content="用户认证,介绍,数据库注意事项,认证快速入门,路由,视图,认证,获取已认证之用户,限制路由访问,错误尝试限制,手动认证用户,记住用户,其它认证方法,HTTP 基础认证,无状态 HTTP 基础认证,重设密码,重设数据库,路由,视图,...
">
	<meta name="keywords" content="laravel,laravel中国,laravel中文,laravel框架中文,laravel文档,laravel框架中国,laravel中文文档">
	<meta name="viewport" content="width=device-width, initial-scale=1">
			<link rel="canonical" href="../5.4/authentication.html" />
		<!--[if lte IE 9]>
		<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<link rel="stylesheet" href="../../build/assets/css/laravel-3d54d47ea3.css">
	<link rel="apple-touch-icon" href="../../favicon.png.jpeg">
</head>
<body class="docs language-php">

	<span class="overlay"></span>

	<nav class="main">
		<a href="../../index.html" class="brand nav-block">
			<svg version="1.1"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
	 x="0px" y="0px" width="84.1px" height="57.6px" viewBox="0 0 84.1 57.6" enable-background="new 0 0 84.1 57.6"
	 xml:space="preserve">
<defs>
</defs>
<path fill="#FB503B" d="M83.8,26.9c-0.6-0.6-8.3-10.3-9.6-11.9c-1.4-1.6-2-1.3-2.9-1.2s-10.6,1.8-11.7,1.9c-1.1,0.2-1.8,0.6-1.1,1.6
	c0.6,0.9,7,9.9,8.4,12l-25.5,6.1L21.2,1.5c-0.8-1.2-1-1.6-2.8-1.5C16.6,0.1,2.5,1.3,1.5,1.3c-1,0.1-2.1,0.5-1.1,2.9
	c1,2.4,17,36.8,17.4,37.8c0.4,1,1.6,2.6,4.3,2c2.8-0.7,12.4-3.2,17.7-4.6c2.8,5,8.4,15.2,9.5,16.7c1.4,2,2.4,1.6,4.5,1
	c1.7-0.5,26.2-9.3,27.3-9.8c1.1-0.5,1.8-0.8,1-1.9c-0.6-0.8-7-9.5-10.4-14c2.3-0.6,10.6-2.8,11.5-3.1C84.2,28,84.4,27.5,83.8,26.9z
	 M37.5,36.4c-0.3,0.1-14.6,3.5-15.3,3.7c-0.8,0.2-0.8,0.1-0.8-0.2C21.2,39.6,4.4,4.8,4.1,4.4c-0.2-0.4-0.2-0.8,0-0.8
	c0.2,0,13.5-1.2,13.9-1.2c0.5,0,0.4,0.1,0.6,0.4c0,0,18.7,32.3,19,32.8C38,36.1,37.8,36.3,37.5,36.4z M77.7,43.9
	c0.2,0.4,0.5,0.6-0.3,0.8c-0.7,0.3-24.1,8.2-24.6,8.4c-0.5,0.2-0.8,0.3-1.4-0.6s-8.2-14-8.2-14L68.1,32c0.6-0.2,0.8-0.3,1.2,0.3
	C69.7,33,77.5,43.6,77.7,43.9z M79.3,26.3c-0.6,0.1-9.7,2.4-9.7,2.4l-7.5-10.2c-0.2-0.3-0.4-0.6,0.1-0.7c0.5-0.1,9-1.6,9.4-1.7
	c0.4-0.1,0.7-0.2,1.2,0.5c0.5,0.6,6.9,8.8,7.2,9.1C80.3,26,79.9,26.2,79.3,26.3z"/>
</svg>

			<span>Laravel</span>
		</a>

        <div class="search nav-block">
            <svg version="1.1"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
	 x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<defs>
</defs>
<g>
	<g>
		<path fill="#A1A1A1" d="M5.8,11.7c-1.6,0-3-0.6-4.1-1.7S0,7.4,0,5.8s0.6-3,1.7-4.1C2.8,0.6,4.3,0,5.8,0s3,0.6,4.1,1.7
			c2.3,2.3,2.3,6,0,8.3C8.9,11.1,7.4,11.7,5.8,11.7z M5.8,1C4.5,1,3.3,1.5,2.4,2.4C1.5,3.3,1,4.5,1,5.8s0.5,2.5,1.4,3.4
			c0.9,0.9,2.1,1.4,3.4,1.4s2.5-0.5,3.4-1.4c1.9-1.9,1.9-5,0-6.9C8.4,1.5,7.1,1,5.8,1z"/>
	</g>
	<g>
		<path fill="#A1A1A1" d="M15.5,16c-0.1,0-0.3,0-0.3-0.1L9.3,10c-0.2-0.2-0.2-0.5,0-0.7s0.5-0.2,0.7,0l5.9,5.9
			c0.2,0.2,0.2,0.5,0,0.7C15.8,16,15.6,16,15.5,16z"/>
	</g>
</g>
</svg>

            <input placeholder="搜索文档" type="text" v-model="search" id="search-input" v-on:blur="reset" />
        </div>

		<ul class="main-nav" v-if="! search">
			<li class="nav-docs"><a href="../5.4.html">文档</a></li>
<li ><a href="https://news.laravel-china.org/" class="no-pjax">Laravel 资讯</a></li>
<li class="dropdown"><a href="https://laravel-china.org/">Laravel China 社区</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/categories/1">酷工作</a></li>
<li class="nav-docs"><a href="http://lumen.laravel-china.org">Lumen</a></li>
<li class="nav-forge"><a href="https://cs.laravel-china.org/">速查表</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/laravel-tutorial/5.1/about">《Laravel 入门教程》</a></li>
		</ul>

        			<div class="switcher">
	<div class="dropdown">
		<button class="btn dropdown-toggle btn-inverted" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
			<!--<span class="faint">v</span> -->
			5.1
			<span class="caret"></span>
		</button>
		<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
							<li role="presentation">
					<a role="menuitem" tabindex="-1" href="../5.4/authentication.html">5.4</a>
				</li>
							<li role="presentation">
					<a role="menuitem" tabindex="-1" href="../5.3/authentication.html">5.3</a>
				</li>
							<li role="presentation">
					<a role="menuitem" tabindex="-1" href="../5.2/authentication.html">5.2</a>
				</li>
							<li role="presentation">
					<a role="menuitem" tabindex="-1" href="authentication.html">5.1</a>
				</li>
					</ul>
	</div>
</div>
		
        <div class="responsive-sidebar-nav">
			<a href="authentication.html#" class="toggle-slide menu-link btn">&#9776;</a>
		</div>
	</nav>

	<nav id="slide-menu" class="slide-menu" role="navigation">

	<div class="brand">
		<a href="../../index.html">
			<img src="../../assets/img/laravel-logo-white.png" height="50">
		</a>
	</div>

	<ul class="slide-main-nav">
		<li><a href="../../index.html">Home</a></li>
		<li class="nav-docs"><a href="../5.4.html">文档</a></li>
<li ><a href="https://news.laravel-china.org/" class="no-pjax">Laravel 资讯</a></li>
<li class="dropdown"><a href="https://laravel-china.org/">Laravel China 社区</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/categories/1">酷工作</a></li>
<li class="nav-docs"><a href="http://lumen.laravel-china.org">Lumen</a></li>
<li class="nav-forge"><a href="https://cs.laravel-china.org/">速查表</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/laravel-tutorial/5.1/about">《Laravel 入门教程》</a></li>
	</ul>

	<div class="slide-docs-nav">
		<h2>Documentation</h2>
		<ul>
<li>前言
<ul>
<li><a href="about.html">翻译说明</a></li>
<li><a href="releases.html">发行说明</a></li>
<li><a href="upgrade.html">升级导引</a></li>
<li><a href="contributions.html">贡献导引</a></li>
<li><a href="http://laravel-china.org/api/5.1">API 文档</a></li>
</ul></li>
<li>环境配置
<ul>
<li><a href="installation.html">安装</a></li>
<li><a href="homestead.html">Homestead</a></li>
</ul></li>
<li>基本功能
<ul>
<li><a href="routing.html">路由</a></li>
<li><a href="middleware.html">中间件</a></li>
<li><a href="controllers.html">控制器</a></li>
<li><a href="requests.html">请求</a></li>
<li><a href="responses.html">响应</a></li>
<li><a href="views.html">视图</a></li>
<li><a href="blade.html">Blade 模板</a></li>
</ul></li>
<li>教程
<ul>
<li><a href="quickstart.html">初级任务清单</a></li>
<li><a href="quickstart-intermediate.html">中级任务清单</a></li>
</ul></li>
<li>系统架构
<ul>
<li><a href="lifecycle.html">请求生命周期</a></li>
<li><a href="structure.html">应用程序结构</a></li>
<li><a href="providers.html">服务提供者</a></li>
<li><a href="container.html">服务容器</a></li>
<li><a href="contracts.html">Contracts</a></li>
<li><a href="facades.html">Facades</a></li>
</ul></li>
<li>系统服务
<ul>
<li><a href="authentication.html">用户认证</a></li>
<li><a href="authorization.html">用户授权</a></li>
<li><a href="artisan.html">Artisan 命令行</a></li>
<li><a href="billing.html">交易</a></li>
<li><a href="cache.html">缓存</a></li>
<li><a href="collections.html">集合</a></li>
<li><a href="elixir.html">Elixir</a></li>
<li><a href="encryption.html">加密与解密</a></li>
<li><a href="errors.html">错误与日志</a></li>
<li><a href="events.html">事件</a></li>
<li><a href="filesystem.html">文件系统与云存储</a></li>
<li><a href="hashing.html">哈希</a></li>
<li><a href="helpers.html">辅助函数</a></li>
<li><a href="localization.html">本地化</a></li>
<li><a href="mail.html">邮件</a></li>
<li><a href="packages.html">扩展包开发</a></li>
<li><a href="pagination.html">分页</a></li>
<li><a href="queues.html">队列</a></li>
<li><a href="redis.html">Redis</a></li>
<li><a href="session.html">Session</a></li>
<li><a href="envoy.html">Envoy</a></li>
<li><a href="scheduling.html">任务调度</a></li>
<li><a href="testing.html">测试</a></li>
<li><a href="validation.html">表单验证</a></li>
</ul></li>
<li>数据库
<ul>
<li><a href="database.html">入门</a></li>
<li><a href="queries.html">查询构造器</a></li>
<li><a href="migrations.html">数据库迁移</a></li>
<li><a href="seeding.html">数据填充</a></li>
</ul></li>
<li>Eloquent ORM
<ul>
<li><a href="eloquent.html">入门</a></li>
<li><a href="eloquent-relationships.html">模型关联</a></li>
<li><a href="eloquent-collections.html">Eloquent 集合</a></li>
<li><a href="eloquent-mutators.html">Getter/Setter</a></li>
<li><a href="eloquent-serialization.html">序列化</a></li>
</ul></li>
</ul>
	</div>

</nav>

<div class="docs-wrapper container">

	<section class="sidebar">

            <div class="header">
              <a type="button" class="btn btn-primary btn-inverted btn-lg btn-block turnofflight"><i class="fa fa-lightbulb-o"></i> 夜间模式 </a>
              <br>
              <div class="versions text-center ">
                <a class="doc-btn btn-inverted " href="../5.4.html" title="Laravel 5.4 中文文档">C5.4</a>
                <a class="doc-btn btn-inverted " href="../5.3.html" title="Laravel 5.3 中文文档">C5.3</a>
                <a class="doc-btn btn-inverted active" href="../5.1.html" title="Laravel 5.1 中文文档">C5.1</a>
              </div>
            </div>

            <a href="https://laravel-china.org/topics/3383" target="_blank" rel="nofollow" title="" style="display: block;margin-bottom: 23px;">
                <img src="https://dn-phphub.qbox.me/uploads/images/201612/10/1/k7wwMpJduq.jpg" style="width: 100%;border: 1px solid #d8d3d3;box-shadow: 0 0 30px #d4d4d4;-moz-box-shadow: 0 0 30px #ccc;-webkit-box-shadow: 0 0 30px #d4d4d4;margin-bottom: 30px;margin-top: 10px;border-radius: 4px;">
            </a>

		<ul>
<li>前言
<ul>
<li><a href="about.html">翻译说明</a></li>
<li><a href="releases.html">发行说明</a></li>
<li><a href="upgrade.html">升级导引</a></li>
<li><a href="contributions.html">贡献导引</a></li>
<li><a href="http://laravel-china.org/api/5.1">API 文档</a></li>
</ul></li>
<li>环境配置
<ul>
<li><a href="installation.html">安装</a></li>
<li><a href="homestead.html">Homestead</a></li>
</ul></li>
<li>基本功能
<ul>
<li><a href="routing.html">路由</a></li>
<li><a href="middleware.html">中间件</a></li>
<li><a href="controllers.html">控制器</a></li>
<li><a href="requests.html">请求</a></li>
<li><a href="responses.html">响应</a></li>
<li><a href="views.html">视图</a></li>
<li><a href="blade.html">Blade 模板</a></li>
</ul></li>
<li>教程
<ul>
<li><a href="quickstart.html">初级任务清单</a></li>
<li><a href="quickstart-intermediate.html">中级任务清单</a></li>
</ul></li>
<li>系统架构
<ul>
<li><a href="lifecycle.html">请求生命周期</a></li>
<li><a href="structure.html">应用程序结构</a></li>
<li><a href="providers.html">服务提供者</a></li>
<li><a href="container.html">服务容器</a></li>
<li><a href="contracts.html">Contracts</a></li>
<li><a href="facades.html">Facades</a></li>
</ul></li>
<li>系统服务
<ul>
<li><a href="authentication.html">用户认证</a></li>
<li><a href="authorization.html">用户授权</a></li>
<li><a href="artisan.html">Artisan 命令行</a></li>
<li><a href="billing.html">交易</a></li>
<li><a href="cache.html">缓存</a></li>
<li><a href="collections.html">集合</a></li>
<li><a href="elixir.html">Elixir</a></li>
<li><a href="encryption.html">加密与解密</a></li>
<li><a href="errors.html">错误与日志</a></li>
<li><a href="events.html">事件</a></li>
<li><a href="filesystem.html">文件系统与云存储</a></li>
<li><a href="hashing.html">哈希</a></li>
<li><a href="helpers.html">辅助函数</a></li>
<li><a href="localization.html">本地化</a></li>
<li><a href="mail.html">邮件</a></li>
<li><a href="packages.html">扩展包开发</a></li>
<li><a href="pagination.html">分页</a></li>
<li><a href="queues.html">队列</a></li>
<li><a href="redis.html">Redis</a></li>
<li><a href="session.html">Session</a></li>
<li><a href="envoy.html">Envoy</a></li>
<li><a href="scheduling.html">任务调度</a></li>
<li><a href="testing.html">测试</a></li>
<li><a href="validation.html">表单验证</a></li>
</ul></li>
<li>数据库
<ul>
<li><a href="database.html">入门</a></li>
<li><a href="queries.html">查询构造器</a></li>
<li><a href="migrations.html">数据库迁移</a></li>
<li><a href="seeding.html">数据填充</a></li>
</ul></li>
<li>Eloquent ORM
<ul>
<li><a href="eloquent.html">入门</a></li>
<li><a href="eloquent-relationships.html">模型关联</a></li>
<li><a href="eloquent-collections.html">Eloquent 集合</a></li>
<li><a href="eloquent-mutators.html">Getter/Setter</a></li>
<li><a href="eloquent-serialization.html">序列化</a></li>
</ul></li>
</ul>

		<hr>
            <ul>
              <li>社交账号
                <ul>
                  <li><a href="http://weibo.com/laravelnews">微博：「Laravel资讯」</a></li>
                  <li>
                    新手 QQ 群：483184286
                  </li>
                  <li>
                    <br>
                    订阅 Laravel 资讯
<img class="image-border popover-with-html" data-content="" src="https://dn-phphub.qbox.me/uploads/images/201609/19/1/pVYzokV0Od.jpg" style="width: 148px;height: 148px;border:1px solid #ccc;padding:2px;border-radius:3px;margin-top:5px;" data-original-title="" title="">
                  </li>

                </ul>
              </li>
            </ul>

	</section>

	

	<article>

		<div class="alert alert-warning" role="alert">
			一小时同步一次，更多信息请查阅 <a href="https://laravel-china.org/topics/2095">文档导读</a>。
			发现瑕疵？你也可以
				<a href="https://github.com/laravel-china/laravel-docs/edit/5.1/authentication.md"><i class="fa fa-pencil-square-o"></i> 改进本文</a>
			。
		</div>

		<div class="main-content">
			<h1>用户认证</h1>
<ul>
<li><a href="authentication.html#introduction">介绍</a>
<ul>
<li><a href="authentication.html#introduction-database-considerations">数据库注意事项</a></li>
</ul></li>
<li><a href="authentication.html#authentication-quickstart">认证快速入门</a>
<ul>
<li><a href="authentication.html#included-routing">路由</a></li>
<li><a href="authentication.html#included-views">视图</a></li>
<li><a href="authentication.html#included-authenticating">认证</a></li>
<li><a href="authentication.html#retrieving-the-authenticated-user">获取已认证之用户</a></li>
<li><a href="authentication.html#protecting-routes">限制路由访问</a></li>
<li><a href="authentication.html#authentication-throttling">错误尝试限制</a></li>
</ul></li>
<li><a href="authentication.html#authenticating-users">手动认证用户</a>
<ul>
<li><a href="authentication.html#remembering-users">记住用户</a></li>
<li><a href="authentication.html#other-authentication-methods">其它认证方法</a></li>
</ul></li>
<li><a href="authentication.html#http-basic-authentication">HTTP 基础认证</a>
<ul>
<li><a href="authentication.html#stateless-http-basic-authentication">无状态 HTTP 基础认证</a></li>
</ul></li>
<li><a href="authentication.html#resetting-passwords">重设密码</a>
<ul>
<li><a href="authentication.html#resetting-database">重设数据库</a></li>
<li><a href="authentication.html#resetting-routing">路由</a></li>
<li><a href="authentication.html#resetting-views">视图</a></li>
<li><a href="authentication.html#after-resetting-passwords">重设密码后</a></li>
</ul></li>
<li><a href="authentication.html#social-authentication">社会化认证</a></li>
<li><a href="authentication.html#adding-custom-authentication-drivers">添加自定义认证驱动</a></li>
<li><a href="authentication.html#events">事件</a></li>
</ul>
<p><a name="introduction"></a></p>
<h2>介绍</h2>
<p>Laravel 让用户认证变得非常简单。几乎所有的认证行为都可以通过配置信息 <code>config/auth.php</code> 来控制。</p>
<p><a name="introduction-database-considerations"></a></p>
<h3>数据库注意事项</h3>
<p>默认的 Laravel 在 <code>app</code> 文件夹中会含有 <code>App\User</code> <a href="eloquent.html">Eloquent 模型</a>。这个模型将使用默认的 Eloquent 认证来驱动。如果你的应用程序没有使用 Eloquent，请选择使用 Laravel 查询构造器的 <code>database</code> 认证驱动。</p>
<p>为 <code>App\User</code> 模型创建数据库表结构时，确认密码字段最少必须 60 字符长。</p>
<p><code>users</code> 数据表中必须含有 nullable 、100 字符长的 <code>remember_token</code> 字段，这个字段将会被用来保存「记住我」 session 的令牌。只要在创建迁移时，使用 <code>$table-&gt;rememberToken()</code>，即可轻松加入这个字段。</p>
<p><a name="authentication-quickstart"></a></p>
<h2>认证快速入门</h2>
<p>Laravel 带有两个认证控制器，它们被放置在 <code>App\Http\Controllers\Auth</code> 命名空间内，<code>AuthController</code> 处理用户注册及认证，而 <code>PasswordController</code> 负责处理重置用户的密码。</p>
<p>这些控制器使用了 trait 来包含所需要的方法，对于大多数的应用程序而言，你并不需要修改这些控制器。</p>
<p><a name="included-routing"></a></p>
<h3>路由</h3>
<p>默认没有 <a href="routing.html">路由</a> 指向这些认证控制器，需要自己添加到 <code>app/Http/routes.php</code> 中。</p>
<pre><code>// 认证路由...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// 注册路由...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');</code></pre>
<p><a name="included-views"></a></p>
<h3>视图</h3>
<p>虽然这些认证控制器被包含在框架中，你仍需提供 <a href="views.html">视图</a> 给控制器渲染，而视图需要被放置在 <code>resources/views/auth</code> 文件夹中，你可以任意的自定义这些视图。</p>
<p>登录视图应该被放在 <code>resources/views/auth/login.blade.php</code> 而注册视图则放在 <code>resources/views/auth/register.blade.php</code>。</p>
<h4>认证表单例子</h4>
<pre><code>&lt;!-- resources/views/auth/login.blade.php --&gt;

&lt;form method="POST" action="/auth/login"&gt;
    {!! csrf_field() !!}

    &lt;div&gt;
        Email
        &lt;input type="email" name="email" value="{{ old('email') }}"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        Password
        &lt;input type="password" name="password" id="password"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;input type="checkbox" name="remember"&gt; Remember Me
    &lt;/div&gt;

    &lt;div&gt;
        &lt;button type="submit"&gt;Login&lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;</code></pre>
<h4>注册表单例子</h4>
<pre><code>&lt;!-- resources/views/auth/register.blade.php --&gt;

&lt;form method="POST" action="/auth/register"&gt;
    {!! csrf_field() !!}

    &lt;div&gt;
        Name
        &lt;input type="text" name="name" value="{{ old('name') }}"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        Email
        &lt;input type="email" name="email" value="{{ old('email') }}"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        Password
        &lt;input type="password" name="password"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        Confirm Password
        &lt;input type="password" name="password_confirmation"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;button type="submit"&gt;Register&lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;</code></pre>
<p><a name="included-authenticating"></a></p>
<h3>认证</h3>
<p>现在你已经为认证控制器设置好了路由及视图，你可以在应用程序注册并认证新用户了。</p>
<p>只需要在浏览器简单地访问定义的路由就行了，认证控制器早已包含了处理认证现有用户，及保存新用户在数据库的逻辑了（通过他们各自的 traits）。</p>
<p>当用户成功认证后，他们将被重定向到 <code>/home</code> URI，而你需要向路由注册此 URI 来处理这个请求，也可以自定义认证后转向的 URI，只需修改 <code>AuthController</code> 的 <code>redirectPath</code> 属性即可：</p>
<pre><code>protected $redirectPath = '/dashboard';</code></pre>
<p>用户认证失败后，将会被重定向到 <code>/auth/login</code> URI。你可以设置 <code>AuthController</code> 的 <code>loginPath</code> 属性来自定义认证失败后的重定向位置：</p>
<pre><code>protected $loginPath = '/login';</code></pre>
<p><code>loginPath</code> 并不会改变当用户访问受保护的路由时所重定向的路径。该路径是由 <code>App\Http\Middleware\Authenticate</code> 中间件的 <code>handle</code> 方法所控制的。</p>
<h4>自定义表单字段</h4>
<p>如果想要修改注册时的表单字段，或是自定义如何将新用户的记录写入数据库，你可以修改 <code>AuthController</code> 类，这个类负责验证和创建新的用户。</p>
<p><code>AuthController</code> 的 <code>validator</code> 方法包含了对新用户的验证规则。你可以随意的修改这个方法。</p>
<p><code>AuthController</code> 的 <code>create</code> 方法负责使用 <a href="eloquent.html">Eloquent ORM</a> 来创建新的 <code>App\User</code> 纪录到数据库。你可以根据需求任意修改这个方法。</p>
<p><a name="retrieving-the-authenticated-user"></a></p>
<h3>获取已认证的用户信息</h3>
<p>可以通过 <code>Auth</code> facade 来访问认证的用户。</p>
<pre><code>$user = Auth::user();</code></pre>
<p>也有另外一种方法可以访问认证过的用户，就是通过 <code>Illuminate\Http\Request</code> 实例：</p>
<pre><code>&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class ProfileController extends Controller
{
    /**
     * 更新用户的数据
     *
     * @param  Request  $request
     * @return Response
     */
    public function updateProfile(Request $request)
    {
        if ($request-&gt;user()) {
            // $request-&gt;user() 返回认证过的用户的实例...
        }
    }
}</code></pre>
<h4>检查用户是否登录</h4>
<p>使用 <code>Auth</code> facade 的 <code>check</code> 方法来检查用户是否登录，如果已经登录，将会返回 <code>true</code>：</p>
<pre><code>if (Auth::check()) {
    // 这个用户已经登录...
}</code></pre>
<p>在允许该用户访问特定的路由或控制器之前，可以使用中间件来检查用户是否认证过。要想得到更多信息，请阅读 <a href="authentication.html#protecting-routes">限制路由访问</a> 的文档。</p>
<p><a name="protecting-routes"></a></p>
<h3>限制路由访问</h3>
<p><a href="middleware.html">路由中间件</a> 用于限定认证过的用户访问指定的路由，Laravel 提供了 <code>auth</code> 中间件来达到这个目的，而这个中间件被定义在 <code>app\Http\Middleware\Authenticate.php</code> 中，只需要将它应用到路由定义中：</p>
<pre><code>// 使用路由闭包...
Route::get('profile', ['middleware' =&gt; 'auth', function() {
    // 只有认证过的用户能进来这里...
}]);

// 使用控制器...
Route::get('profile', [
    'middleware' =&gt; 'auth',
    'uses' =&gt; 'ProfileController@show'
]);</code></pre>
<p>如果使用 <a href="controllers.html">控制器类</a>，可以在构造器中调用 <code>middleware</code> 方法：</p>
<pre><code>public function __construct()
{
    // 执行 auth 认证
    $this-&gt;middleware('auth');
}</code></pre>
<p><a name="authentication-throttling"></a></p>
<h3>错误尝试限制</h3>
<p>Laravel 内置的 <code>AuthController</code> 类提供 <code>Illuminate\Foundation\Auth\ThrottlesLogins</code> trait 允许你在应用程序中限制登录次数。</p>
<p>默认情况下，如果用户在进行几次尝试后仍不能提供正确的凭证，将在一分钟内无法进行登录。这个限制会特别针对用户的用户名称 / 邮件地址和他们的 IP 地址：</p>
<pre><code>&lt;?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    // 重置 AuthController 类...
}</code></pre>
<p><a name="authenticating-users"></a></p>
<h2>手动认证用户</h2>
<p>当然，不一定要使用 Laravel 内置的认证控制器，你可以选择删除这些控制器，然后创建自定义的控制器。</p>
<p>我们可以利用 <code>Auth</code> <a href="facades.html">facade</a> 来访问 Laravel 的认证服务，从而实现手动认证。</p>
<p>接下来让我们看一下 <code>Auth</code> 的 <code>attempt</code> 方法：</p>
<pre><code>&lt;?php

namespace App\Http\Controllers;

use Auth;
use Illuminate\Routing\Controller;

class AuthController extends Controller
{
    /**
     * 处理认证
     *
     * @return Response
     */
    public function authenticate()
    {
        // 尝试登录
        if (Auth::attempt(['email' =&gt; $email, 'password' =&gt; $password])) {
            // 认证通过...
            return redirect()-&gt;intended('dashboard');
        }
    }
}</code></pre>
<p><code>attempt</code> 方法会接受一个数组来作为第一个参数，这个数组的值可用来寻找数据库里的用户数据，所以在上面的例子中，用户通过 <code>email</code> 字段被取出，如果用户被找到了，数据库里经过哈希的密码将会与数组中哈希的 <code>password</code> 值比对，如果两个值一样的话就会开启一个通过认证的 session 给用户。</p>
<p>如果认证成功，<code>attempt</code> 方法将会返回 <code>true</code>，反之则为 <code>false</code>。</p>
<p>重定向器上的 <code>intended</code> 方法将会重定向用户回原本想要进入的页面，也可以传入一个回退 URI 至这个方法，以避免要转回的页面不可使用。</p>
<p>可以加入除用户的邮箱及密码外的额外条件进行认证查找。例如，我们要确认用户是否被标示为 <code>active</code>：</p>
<pre><code>if (Auth::attempt(['email' =&gt; $email, 'password' =&gt; $password, 'active' =&gt; 1])) {
    // 此用户是已激活的、没被停权的、且存在的用户
}</code></pre>
<p>要想让用户注销，你可以使用 <code>Auth</code> facade 的 <code>logout</code> 方法。这个方法会清除所有认证后加入到用户 session 的数据：</p>
<pre><code>Auth::logout();</code></pre>
<blockquote>
<p><strong>注意：</strong> 在这些例子中，<code>email</code> 不是一个一定要有的选项，它仅仅是被用来当作例子，你可以用任何字段，如「手机号码」，只要它在数据库的意义等同于「用户名」。</p>
</blockquote>
<p><a name="remembering-users"></a></p>
<h2>记住用户</h2>
<p>如果你想要提供「记住我」的功能，你需要传入一个布尔值到 <code>attempt</code> 方法的第二个参数，在用户注销前 session 值都会被一直保存。</p>
<p><code>users</code> 数据表一定要包含一个 <code>remember_token</code> 字段，这是用来保存「记住我」令牌的。</p>
<pre><code>if (Auth::attempt(['email' =&gt; $email, 'password' =&gt; $password], $remember)) {
    // 这个用户被记住了...
}</code></pre>
<p>可以使用 <code>viaRemember</code> 方法来检查这个用户是否使用「记住我」 cookie 来做认证：</p>
<pre><code>if (Auth::viaRemember()) {
    //
}</code></pre>
<p><a name="other-authentication-methods"></a></p>
<h3>其它认证方法</h3>
<h4>用「用户实例」做认证</h4>
<p>如果你需要使用存在的用户实例来登录，你需要调用 <code>login</code> 方法，并传入使用实例，这个对象必须是由 <code>Illuminate\Contracts\Auth\Authenticatable</code> <a href="contracts.html">contract</a> 所实现。当然，<code>App/User</code> 模型已经实现了这个接口：</p>
<pre><code>Auth::login($user);</code></pre>
<h4>用用户 ID 做认证</h4>
<p>使用 <code>loginUsingId</code> 方法来登录指定 ID 用户，这个方法接受要登录用户的主键：</p>
<pre><code>Auth::loginUsingId(1);</code></pre>
<h4>仅在本次认证用户</h4>
<p>可以使用 <code>once</code> 方法来针对一次性认证用户，没有任何的 session 或 cookie 会被使用，这个对于构建无状态的 API 非常的有用，<code>once</code> 方法跟 <code>attempt</code> 方法拥有同样的传入参数：</p>
<pre><code>if (Auth::once($credentials)) {
    //
}</code></pre>
<p><a name="http-basic-authentication"></a></p>
<h2>HTTP 基础认证</h2>
<p><a href="http://en.wikipedia.org/wiki/Basic_access_authentication">HTTP 基础认证</a> 提供一个快速的方法来认证用户，不需要任何「登录」页面。开始之前，先增加 <code>auth.basic</code> <a href="middleware.html">中间件</a> 到你的路由，<code>auth.basic</code> 中间件已经被包含在 Laravel 框架中，所以你不需要定义它：</p>
<pre><code>Route::get('profile', ['middleware' =&gt; 'auth.basic', function() {
    // 只有认证过的用户可进入...
}]);</code></pre>
<p>一旦中间件被增加到路由上，当使用浏览器进入这个路由时，将自动的被提示需要提供凭证。默认情况下，<code>auth.basic</code> 中间件将会使用用户的 <code>email</code> 字段当作「用户名」。</p>
<h4>FastCGI 的注意事项</h4>
<p>如果是正在使用 FastCGI，则 HTTP 的基础认证可能无法正常运作，你需要将下面这几行加入你 <code>.htaccess</code> 文件中：</p>
<pre><code>RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</code></pre>
<p><a name="stateless-http-basic-authentication"></a></p>
<h3>无状态 HTTP 基础认证</h3>
<p>你可以使用 HTTP 基础认证而不用在 session 中设置用户认证用的 cookie，这个功能对 API 认证来说非常有用。为了达到这个目的，<a href="middleware.html">定义一个中间件</a> 并调用 <code>onceBasic</code> 方法。如果从 <code>onceBasic</code> 方法没有返回任何响应的话，这个请求会直接传进应用程序中：</p>
<pre><code>&lt;?php

namespace Illuminate\Auth\Middleware;

use Auth;
use Closure;

class AuthenticateOnceWithBasicAuth
{
    /**
     * 处理请求
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return Auth::onceBasic() ?: $next($request);
    }

}</code></pre>
<p>接着，<a href="middleware.html#registering-middleware">注册这个路由中间件</a>，然后将它增加在一个路由上：</p>
<pre><code>Route::get('api/user', ['middleware' =&gt; 'auth.basic.once', function() {
    // 只有认证过的用户可以进入...
}]);</code></pre>
<p><a name="resetting-passwords"></a></p>
<h2>重设密码</h2>
<p><a name="resetting-database"></a></p>
<h3>重设数据库</h3>
<p>很多 Web 应用程序都会提供用户重设密码功能，Laravel 提供了发送重置密码邮件和实现密码重设功能，避免让你重造车轮。</p>
<p>开始之前，请先确认 <code>App\User</code> 模型实现了 <code>Illuminate\Contracts\Auth\CanResetPassword</code> contract。当然，原有的 <code>App\User</code> 早已实现了这个接口，并且使用 <code>Illuminate\Auth\Passwords\CanResetPassword</code> trait 引入实现这个接口所需要的方法。</p>
<h4>生成重置令牌的数据表迁移文件</h4>
<p>接下来，必须要创建一个用来保存密码重置令牌的数据表，而这个数据表的迁移已经包含在 Laravel 中了，就在 <code>database/migrations</code> 文件夹里。所以，你要做的就是做一次迁移：</p>
<pre><code>php artisan migrate</code></pre>
<p><a name="resetting-routing"></a></p>
<h3>路由</h3>
<p>Laravel 包含了 <code>Auth\PasswordController</code>，虽然它含有所有重置用户密码的逻辑，但是你仍需要指定路由到这个控制器上：</p>
<pre><code>// 密码重置链接的路由...
Route::get('password/email', 'Auth\PasswordController@getEmail');
Route::post('password/email', 'Auth\PasswordController@postEmail');

// 密码重置的路由...
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');
Route::post('password/reset', 'Auth\PasswordController@postReset');</code></pre>
<p><a name="resetting-views"></a></p>
<h3>视图</h3>
<p>除了定义 <code>PasswordController</code> 路由，还需要提供视图给这个控制器。不过不用担心，我们已经提供了样例视图来帮助你开始，你也可以随意的定义表单风格。</p>
<h4>重置密码链接的请求表单例子</h4>
<p>你需要提供 HTML 视图给密码重置的请求表单。这些视图被放在 <code>resources/views/auth/password.blade.php</code>。这个表单提供了单个的字段来给用户输入邮箱，让他们可以收到密码重置链接：</p>
<pre><code>&lt;!-- resources/views/auth/password.blade.php --&gt;

&lt;form method="POST" action="/password/email"&gt;
    {!! csrf_field() !!}

    @if (count($errors) &gt; 0)
        &lt;ul&gt;
            @foreach ($errors-&gt;all() as $error)
                &lt;li&gt;{{ $error }}&lt;/li&gt;
            @endforeach
        &lt;/ul&gt;
    @endif

    &lt;div&gt;
        Email
        &lt;input type="email" name="email" value="{{ old('email') }}"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;button type="submit"&gt;
            发送重置密码邮件
        &lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;</code></pre>
<p>当用户送出重置密码的请求，他们会收到一封有链接到 <code>PasswordController</code> 的 <code>getReset</code> 方法（通常是路由到 <code>/password/reset</code>）的邮件。</p>
<p>你将需要为这份邮件创造一个 <code>resources/views/emails/password.blade.php</code> 视图。这个视图会接收一个带有密码重置令牌的 <code>$token</code> 变量，用来拼接成为重置密码的 URL，这个 <code>$token</code> 变量含有密码重置令牌来匹配用户的密码重置请求，举例如下：</p>
<pre><code>&lt;!-- 文件 resources/views/emails/password.blade.php --&gt;

点击此处重置你的密码：{{ url('password/reset/'.$token) }}</code></pre>
<h4>密码重置表单的例子</h4>
<p>当用户点击了邮箱的链接来重置密码，将会显示一个密码重置表单，这个视图被放在 <code>resources/views/auth/reset.blade.php</code>。</p>
<p>这里有个密码重置表单的例子：</p>
<pre><code>&lt;!-- resources/views/auth/reset.blade.php --&gt;

&lt;form method="POST" action="/password/reset"&gt;
    {!! csrf_field() !!}
    &lt;input type="hidden" name="token" value="{{ $token }}"&gt;

    @if (count($errors) &gt; 0)
        &lt;ul&gt;
            @foreach ($errors-&gt;all() as $error)
                &lt;li&gt;{{ $error }}&lt;/li&gt;
            @endforeach
        &lt;/ul&gt;
    @endif

    &lt;div&gt;
        电子邮箱
        &lt;input type="email" name="email" value="{{ old('email') }}"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        密码
        &lt;input type="password" name="password"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        重新输入密码
        &lt;input type="password" name="password_confirmation"&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;button type="submit"&gt;
            重置密码
        &lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;</code></pre>
<p><a name="after-resetting-passwords"></a></p>
<h3>重设密码后</h3>
<p>在你定义好路由跟视图之后，你就可以使用浏览器访问这个路由了。</p>
<p><code>PasswordController</code> 已经包含了发送密码重置链接邮箱，及更新密码到数据库的逻辑。</p>
<p>密码重置以后，这个用户会自动登录并重定向到 <code>/home</code>。要自定义重定向地址，只需定义 <code>PasswordController</code> 的 <code>redirectTo</code> 属性即可：</p>
<pre><code>protected $redirectTo = '/dashboard';</code></pre>
<blockquote>
<p><strong>注意：</strong> 默认情况下，密码重置令牌会在一个小时后过期，你可以更改 <code>config/auth.php</code> 的 <code>reminder.expire</code> 选项，来修改这个设置。</p>
</blockquote>
<p><a name="social-authentication"></a></p>
<h2>社会化认证</h2>
<p>除了传统的表单认证之外，Laravel 同样提供了简单方便的方法来认证 OAuth 提供者，这个方法使用了  <a href="https://github.com/laravel/socialite">Laravel Socialite</a>。Socialite 目前支持 Facebook、Twitter、LinkedIn、Google、GitHub 跟 Bitbucket 的认证。</p>
<p>开始使用 Socialite 前，请先添加依赖包至你的 <code>composer.json</code>：</p>
<pre><code>composer require laravel/socialite</code></pre>
<h3>配置信息</h3>
<p>安装 Socialite 之后，到 <code>config/app.php</code> 配置文件中注册 <code>Laravel\Socialite\SocialiteServiceProvider</code>：</p>
<pre><code>'providers' =&gt; [
    // 其它服务提供者...

    Laravel\Socialite\SocialiteServiceProvider::class,
],</code></pre>
<p>此外再添加 <code>Socialite</code> facade 到 <code>app</code> 配置文件的 <code>aliases</code> 数组中：</p>
<pre><code>'Socialite' =&gt; Laravel\Socialite\Facades\Socialite::class,</code></pre>
<p>你将需要添加凭证来使用 OAuth 服务，这些凭证需要被放在 <code>config/services.php</code> 配置文件中，并根据你应用程序的需求，增加 <code>facebook</code>、<code>twitter</code>、<code>linkedin</code>、<code>google</code>、<code>github</code> 或 <code>bitbucket</code> 的键，例如：</p>
<pre><code>'github' =&gt; [
    'client_id' =&gt; 'your-github-app-id',
    'client_secret' =&gt; 'your-github-app-secret',
    'redirect' =&gt; 'http://your-callback-url',
],</code></pre>
<h3>基础应用</h3>
<p>接下来，你已经准备好开始认证用户了！需要两个路由: 一个用来重定向用户到 OAuth 提供者，另一个在认证后接收提供者的回调。我们将会借由 <code>Socialite</code> <a href="facades.html">facade</a> 访问 Socialite：</p>
<pre><code>&lt;?php

namespace App\Http\Controllers;

use Socialite;
use Illuminate\Routing\Controller;

class AuthController extends Controller
{
    /**
     * 重定向用户到 GitHub 认证页。
     *
     * @return Response
     */
    public function redirectToProvider()
    {
        return Socialite::driver('github')-&gt;redirect();
    }

    /**
     * 从 GitHub 得到用户信息
     *
     * @return Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('github')-&gt;user();

        // $user-&gt;token;
    }
}</code></pre>
<p><code>redirect</code> 方法会负责处理并发送用户到 OAuth 提供者，而 <code>user</code> 方法会从提供者返回的请求来获取用户信息。在重定向用户之前，你也可以使用 <code>scopes</code> 方法来设置请求的 「作用域」。这个方法将重写所有已经存在的作用域：</p>
<pre><code>return Socialite::driver('github')
            -&gt;scopes(['scope1', 'scope2'])-&gt;redirect();</code></pre>
<p>当然，你需要指定路由到控制器方法：</p>
<pre><code>Route::get('auth/github', 'Auth\AuthController@redirectToProvider');
Route::get('auth/github/callback', 'Auth\AuthController@handleProviderCallback');</code></pre>
<p>一些 OAuth 提供者支持在重定向的请求中自定义参数。若要在请求中加入任何自定义参数，只要调用 <code>with</code> 方法并带上一个关联数组：</p>
<pre><code>return Socialite::driver('google')
            -&gt;with(['hd' =&gt; 'example.com'])-&gt;redirect();</code></pre>
<h4>获取用户详情信息</h4>
<p>一旦你有了用户的实例，你就可以获取用户更详细的信息:</p>
<pre><code>$user = Socialite::driver('github')-&gt;user();

// OAuth Two 提供者
$token = $user-&gt;token;

// OAuth One 提供者
$token = $user-&gt;token;
$tokenSecret = $user-&gt;tokenSecret;

// 所有提供者
$user-&gt;getId();
$user-&gt;getNickname();
$user-&gt;getName();
$user-&gt;getEmail();
$user-&gt;getAvatar();</code></pre>
<p><a name="adding-custom-authentication-drivers"></a></p>
<h2>添加自定义的认证驱动</h2>
<p>如果你不是使用传统的关系型数据库来保存用户，你将需要扩充 Laravel 来添加你自己的认证驱动。我们将使用 <code>Auth</code> facade 的 <code>extend</code> 方法来定义自定义驱动。你应该将 <code>extend</code> 放置在 <a href="providers.html">服务提供者</a> 中：</p>
<pre><code>&lt;?php

namespace App\Providers;

use Auth;
use App\Extensions\RiakUserProvider;
use Illuminate\Support\ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * 运行服务注册后的启动进程。
     *
     * @return void
     */
    public function boot()
    {
        Auth::extend('riak', function($app) {
            // 返回 Illuminate\Contracts\Auth\UserProvider 的实例...
            return new RiakUserProvider($app['riak.connection']);
        });
    }

    /**
     * 在容器注册绑定。
     *
     * @return void
     */
    public function register()
    {
        //
    }
}</code></pre>
<p>在你用 <code>extend</code> 方法注册这个驱动后，你可以在 <code>config/auth.php</code> 转换到新的驱动。</p>
<h3>用户提供者 Contract</h3>
<p><code>Illuminate\Contracts\Auth\UserProvider</code> 的实现只负责获取 <code>Illuminate\Contracts\Auth\Authenticatable</code> 的实现， 且不受限于永久保存系统，例如 MySQL, Riak 等等。这两个接口允许 Laravel 认证机制继续作用，而不用管用户如何保存或是使用什么样类型的类实现它。</p>
<p>让我们来看看 <code>Illuminate\Contracts\Auth\UserProvider</code> contract：</p>
<pre><code>&lt;?php

namespace Illuminate\Contracts\Auth;

interface UserProvider {

    public function retrieveById($identifier);
    public function retrieveByToken($identifier, $token);
    public function updateRememberToken(Authenticatable $user, $token);
    public function retrieveByCredentials(array $credentials);
    public function validateCredentials(Authenticatable $user, array $credentials);

}</code></pre>
<p><code>retrieveById</code> 函数通常获取一个代表用户的值，例如 MySQL 中自增的 ID。<code>Authenticatable</code> 的实现通过 ID 匹配的方法来取出和返回。</p>
<p><code>retrieveByToken</code> 函数借助用户唯一的 <code>$identifier</code> 和「记住我」<code>$token</code> 来获取用户。如同之前的方法，<code>Authenticatable</code> 的实现应该被返回。</p>
<p><code>updateRememberToken</code> 方法使用新的 <code>$token</code> 更新了 <code>$user</code> 的 <code>remember_token</code> 字段。这个新的令牌可以是全新的令牌（当使用「记住我」尝试登录成功时），或是 null（当用户注销时）。</p>
<p><code>retrieveByCredentials</code> 方法获取了从 <code>Auth::attempt</code> 方法发送过来的凭证数组（当想要登录时）。这个方法应该要 「查找」所使用的持久化存储系统来匹配这些凭证。通常，这个方法会运行一个带着「where」<code>$credentials['username']</code> 条件的查找。这个方法接着需要返回一个 <code>UserInterface</code> 的实现。<strong>此方法不应该企图做任何密码验证或认证操作。</strong></p>
<p><code>validateCredentials</code> 方法需要比较 <code>$user</code> 和 <code>$credentials</code> 来认证这个用户。例如，这个方法可能会比较 <code>$user-&gt;getAuthPassword()</code> 字符串及 <code>Hash::make</code> 后的 <code>$credentials['password']</code>。这个方法应该只验证用户的凭证并返回一个布尔值。</p>
<h3>可验证之 Contract</h3>
<p>现在我们已经介绍了 <code>UserProvider</code> 的每个方法，让我们看一下 <code>Authenticate</code> contract。这个提供者需要 <code>retrieveById</code> 和 <code>retrieveByCredentials</code> 方法来返回这个接口的实现：</p>
<pre><code>&lt;?php

namespace Illuminate\Contracts\Auth;

interface Authenticatable {

    public function getAuthIdentifier();
    public function getAuthPassword();
    public function getRememberToken();
    public function setRememberToken($value);
    public function getRememberTokenName();

}</code></pre>
<p>这个接口很简单。<code>getAuthIdentifier</code> 方法需要返回用户的「主键」。在 MySQL 中，这个主键是指自动增加的主键。而 <code>getAuthPassword</code> 应该要返回用户哈希后的密码。这个接口允许认证系统和任何用户类运作，不用管你在使用何种 ORM 或存储抽象层。默认情况下，Laravel 的 <code>app</code> 文件夹中会包含 <code>User</code> 类来实现此接口，所以你可以观察这个类以作为实现的例子。</p>
<p><a name="events"></a></p>
<h2>事件</h2>
<p>Laravel 提供了在认证过程中的各种 <a href="events.html">事件</a>。你可以在 <code>EventServiceProvider</code> 中对这些事件做监听：</p>
<pre><code>/**
 * 为你的应用程序注册任何事件。
 *
 * @param  \Illuminate\Contracts\Events\Dispatcher  $events
 * @return void
 */
public function boot(DispatcherContract $events)
{
    parent::boot($events);

    // 在每次尝试认证时触发...
    $events-&gt;listen('auth.attempt', function ($credentials, $remember, $login) {
        //
    });

    // 登录成功时触发...
    $events-&gt;listen('auth.login', function ($user, $remember) {
        //
    });

    // 注销时触发...
    $events-&gt;listen('auth.logout', function ($user) {
        //
    });
}</code></pre>
		</div>

		<div class="main-footer" style="border-top:1px dashed rgba(0, 0, 0, 0.1);padding-top: 30px;margin-top:30px;margin-bottom: 20px;">
			<div class="prev-next-wrap clearfix">

									<a class="btn btn-primary pull-left btn-inverted" href="facades.html"><i class="fa fa-arrow-left"></i> Facades</a>
				
			    &nbsp;
								    <a class="btn btn-primary pull-right btn-inverted" href="authorization.html">用户授权 <i class="fa fa-arrow-right"></i></a>
							</div>
		</div>

	</article>
</div>

	<footer class="main">
		<ul>
			<li class="nav-docs"><a href="../5.4.html">文档</a></li>
<li ><a href="https://news.laravel-china.org/" class="no-pjax">Laravel 资讯</a></li>
<li class="dropdown"><a href="https://laravel-china.org/">Laravel China 社区</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/categories/1">酷工作</a></li>
<li class="nav-docs"><a href="http://lumen.laravel-china.org">Lumen</a></li>
<li class="nav-forge"><a href="https://cs.laravel-china.org/">速查表</a></li>
<li class="nav-forge"><a href="https://laravel-china.org/laravel-tutorial/5.1/about">《Laravel 入门教程》</a></li>
		</ul>
		<p>Laravel is a trademark of Taylor Otwell. Copyright &copy; Taylor Otwell.</p>
		<p class="less-significant">
            <a href="http://jackmcdade.com">
                Designed by<br>
                <svg version="1.1"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
	 x="0px" y="0px" width="128.2px" height="28px" viewBox="0 0 128.2 28" enable-background="new 0 0 128.2 28" xml:space="preserve"
	>
<defs>
</defs>
<g>
	<path fill="#c3c3c3" d="M14.2,0.4c0,0.2,0,0.5,0,0.7c0,0.2,0,0.5,0,0.7l-1.4-0.3C12.9,3,13,4.5,13.1,6c0.1,1.5,0,3-0.1,4.5
		c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.4-0.1,0.8-0.3,1.2c-0.1,0.4-0.3,0.7-0.5,1.1c-0.2,0.3-0.5,0.6-0.9,0.9c-0.4,0.2-0.9,0.4-1.5,0.6
		c-0.6,0.2-1.1,0.3-1.6,0.3c-0.6,0-1.2-0.1-1.6-0.3c-0.5-0.2-0.9-0.6-1.1-1c-0.3-0.5-0.5-1-0.6-1.6c-0.1-0.6-0.1-1.3,0-2.1
		c0-0.2,0.1-0.5,0.2-0.7C4.9,9.9,5,9.7,5.1,9.5c0.1-0.2,0.2-0.4,0.3-0.6l1.1,0.4C6.7,9.3,7,9.4,7.3,9.5c0.3,0.1,0.5,0.1,0.6,0.2
		c0,0.2,0,0.4-0.1,0.5c-0.1,0.2-0.1,0.3-0.2,0.4c-0.1,0.1-0.2,0.3-0.2,0.4c-0.1,0.2-0.1,0.3-0.1,0.5l-1.3-0.7
		c-0.1,0.3-0.2,0.7-0.2,1.1c0,0.4,0.1,0.8,0.2,1.2c0.2,0.4,0.4,0.7,0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.2-0.1,0.5,0,0.7,0.1c0.1-2.1,0.2-4.3,0.1-6.5C116.3,5.5,116.3,3.4,116.5,1.2z"/>
</g>
</svg>

            </a>
        </p>
	</footer>

	<script>
		var algolia_app_id      = 'FU55RWGNDN';
		var algolia_search_key  = 'c41c5de31ca55044dbb0bde815d35121';
				var version             = '5.1';
			</script>

	<script id="search_suggestion_template" type="text/template">
	<div class="autocomplete-wrapper">
		{{#_highlightResult.h1}}
		<div class="h1">
			{{{ _highlightResult.h1.value }}}
		</div>
		{{/_highlightResult.h1}}

		<div class="sub-section">
			{{#_highlightResult.h2}}
			<div class="h2">
				<span class="hash">#</span> {{{ _highlightResult.h2.value }}}
			</div>
			{{/_highlightResult.h2}}

			{{#_highlightResult.h3}}
			<div class="h3">
				> {{{ _highlightResult.h3.value }}}
			</div>
			{{/_highlightResult.h3}}

			{{#_highlightResult.h4}}
			<div class="h4">
				> {{{ _highlightResult.h4.value }}}
			</div>
			{{/_highlightResult.h4}}
		</div>

		{{#_highlightResult.content}}
		<div class="content">
			{{{ _highlightResult.content.value }}}
		</div>
		{{/_highlightResult.content}}
	</div>
</script>

<script id="search_empty_template" type="text/template">
	<div class="autocomplete-wrapper empty">
		<div class="h2">We didn't find any result for "{{query}}". Sorry!</div>
	</div>
</script>

<script id="search_footer_template" type="text/template">
	<div class="footer">
		<a target="_blank" href="https://www.algolia.com/referrals/5a08e6a4/join">
			<img width="50" src="/docs/assets/img/algolia-logo.png">
			<div class="powered">powered by</div>
			<div style="clear: both"></div>
		</a>
	</div>
</script>

	<script src="../../build/assets/js/laravel-db513c8174.js"></script>
	<script src="../../assets/js/viewport-units-buggyfill.js"></script>

	<script>window.viewportUnitsBuggyfill.init();</script>
    <script>
          ga('create', 'UA-53903425-7', 'auto');
          ga('send', 'pageview');
    </script>
</body>
</html>
